package cn.wzvtcsoft.sys.repository;

import cn.wzvtcsoft.base.BaseRepository;
import cn.wzvtcsoft.sys.entity.Permission;
import org.springframework.data.jpa.repository.Query;

import java.util.Set;

public interface PermissionRepository extends BaseRepository<Permission, Long> {

  /**
   * admin允许访问所有权限点（服务端只控制权限点）
   */
  @Query(value = "select distinct path from #{#entityName} where type=1", nativeQuery = true)
  Set<String> findAllPaths();

  /**
   * admin允许访问所有菜单（前端展示）
   */
  @Query(value = "select distinct name from #{#entityName} where type=0", nativeQuery = true)
  Set<String> findAllMenus();
}
